feat(mcp): /mcp disable / enable + disabled lifecycle (Stage C1 of #105)#108
Merged
feat(mcp): /mcp disable / enable + disabled lifecycle (Stage C1 of #105)#108
Conversation
Stage C1 of #105 (Stage C split into C1 = persistence side here, C2 = live reconnect + slow toast next). Add a config-persisted disable list and the corresponding `○ disabled` lifecycle line so users can keep a flaky server in their config but skip it on launch. Touch: - `src/config.ts` — new `mcpDisabled?: string[]` on ReasonixConfig. Backwards-compatible: existing configs ignore it. - `src/cli/ui/mcp-lifecycle.ts` — `disabled` state added to the formatter, prints `○ disabled via /mcp disable <name>`. - `src/cli/commands/chat.tsx` + `src/cli/commands/run.ts` — read the disabled set on startup; skip the bridge for matching named servers and emit the `disabled` lifecycle line in their place. Anonymous servers (no `name=`) are not toggleable, by design. - `src/cli/ui/slash/handlers/mcp.ts` — first-arg dispatch: - `disable <name>` writes the name into `mcpDisabled`, idempotent - `enable <name>` removes from the array; deletes the field entirely when the last entry clears (keeps configs tidy) - `text` / no-arg paths unchanged Unknown names produce a "Known: …" hint listing the valid set (joined from live mcpServers labels + parsed config specs). - `tests/mcp-lifecycle.test.ts` — disabled-state snapshot - `tests/slash.test.ts` — six cases: persistence, idempotent disable, enable that empties the array, enable that clears the field, unknown-name rejection, missing-arg usage line. All isolated through `HOME=tmp` per the existing pattern. Stage C2 (next PR): `/mcp reconnect <name>` (live teardown + re-handshake), p95 latency tracker, slow-server warn toast. Closes part of #105.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage C1 of #105.
I'm splitting the original "Stage C" into two PRs to keep review tractable:
○ disabledlifecycle line/mcp reconnect <name>(live teardown), p95 latency tracker, slow-server toastWhat
Lets a user keep a flaky server in their config but skip it on launch:
Inside a session:
Touch
src/config.ts—mcpDisabled?: string[]onReasonixConfig. Backwards-compatible (missing field reads as empty set).src/cli/ui/mcp-lifecycle.ts—disabledstate added to the formatter union; prints○ disabled via /mcp disable <name>.src/cli/commands/chat.tsx+src/cli/commands/run.ts— read disabled set at startup; skip the bridge for matching named servers and emit thedisabledlifecycle line in their place. Anonymous servers (noname=) aren't toggleable by design.src/cli/ui/slash/handlers/mcp.ts— first-arg dispatch:disable <name>writes name intomcpDisabled, idempotentenable <name>removes from the array; deletes the field entirely when the last entry clears (keeps configs tidy)text/ no-arg paths unchangedtests/mcp-lifecycle.test.ts— disabled-state snapshottests/slash.test.ts— 6 cases for persistence + edge cases, isolated viaHOME=tmpper the existing patternTest plan
npm run verifypasses locally (1745 tests, lint, typecheck, build)disableis idempotent;enableclears the field when the array empties/mcp disable <name>, restart, confirm the○ disabledline appears in startup output